<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<script type="text/javascript">
	window.onload = function (){
		var oForm = document.getElementById('form1');
		var oBtn = document.getElementById('btn');

		oBtn.onclick = function (){
			//alert(oForm.AA.value);		//name名称可以
			alert(oForm.BB.value);			//id名称可以
			//两种都是兼容的

			//alert(oForm.text.value);		type名称不行
		}

	}
	</script>
</head>
<body>
	<form id="form1">
		<input id="AA" name="BB" type="text" value="" />
		<input id="btn" type="button" value="点击访问内容" />
	</form>
</body>
</html>